package org.dromara.wms.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity;

import java.io.Serial;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wms_bom_line")
public class WmsBomLine extends BaseEntity {
  @Serial
  private static final long serialVersionUID = 1L;

  @TableId(value = "line_id", type = IdType.AUTO)
  @ExcelProperty(value = "主键")
  private Long lineId;

  @NotNull(message = "BOM主键不能为空", groups = {AddGroup.class, EditGroup.class})
  @ExcelProperty(value = "BOM主键")
  private Long id;

//  @TableId(value = "product_id", type = IdType.INPUT )
  @NotNull(message = "物品子码不能为空", groups = {AddGroup.class, EditGroup.class})
  @ExcelProperty(value = "物品子码")
  private Long productId;

//  @TableId(value = "parent_id", type = IdType.INPUT)
  @NotNull(message = "物品父码不能为空", groups = {AddGroup.class, EditGroup.class})
  @ExcelProperty(value = "物品父码")
  private Long parentId;

  @ExcelProperty(value = "用量")
  private String quantity;

  @ExcelProperty(value = "是否起")
  private String status;

//  =========================================

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "物品名称")
  @TableField(exist = false)
  private String productName;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "价格")
  @TableField(exist = false)
  private Double price;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "采购价")
  @TableField(exist = false)
  private Double purchasePrice;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "单位")
  @TableField(exist = false)
  private String measureUnit;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "批次号")
  @TableField(exist = false)
  private String batchCode;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "仓库")
  @TableField(exist = false)
  private Long wmId;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "删除物品明细")
  @TableField(exist = false)
  private List<WmsBomLine> deletes;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "更新物品明细")
  @TableField(exist = false)
  private WmsBomLine oldLine;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "物品父id集合")
  @TableField(exist = false)
  private List<Long> parentIds;

  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ExcelProperty(value = "物品子id集合")
  @TableField(exist = false)
  private List<Long> childIds;
}
